package pack0626;

public class Judge {
    public int count;
    //宣布一局的胜负
    public void declareOne(Person p,Computer c){
        System.out.println("形参p: "+p);
        //每调用一次此方法,局数加
        count++;
        //人出拳
        int pn=p.showHand();
        //机器出拳
        int cn=c.showHand();

        //判断
        //输出人和机器出的拳
        System.out.println(p.name+"出拳:"+p.type);
        System.out.println(c.name+"出拳:"+c.type);
        if(pn==1&&cn==2||pn==2&&cn==3||pn==3&&cn==1){
            System.out.println(p.name+"赢得此局胜利");
            p.score++;
        }else if(pn==cn){
            System.out.println("此局双方平手");
        }else{
            System.out.println(c.name+"赢了此局");
            c.score++;
        }
    }
    //宣布最后比赛的结果
    public void declareResult(Person p,Computer c){
        System.out.println("比赛结束,总共进行了"+count+"局");
        System.out.println("比赛结果: "+p.name+"赢了"+p.score+"局");
        System.out.println("比赛结果: "+c.name+"赢了"+c.score+"局");
        System.out.println("比赛结果:双方平手"+(count-p.score-c.score)+"局");

        if(p.score>c.score){
            System.out.println("大白");
        }else if(p.score<c.score){
            System.out.println("大胜");
        }else{
            System.out.println("平局哦");
        }
    }
}
